<template>
  <a-card :bordered="false">
    <detail-list title="基本信息">
      <detail-list-item term="供应商名称">{{info.name}}</detail-list-item>
      <detail-list-item term="供应商编号">{{info.numbering}}</detail-list-item>
      <detail-list-item term="联系人">{{info.contact}}</detail-list-item>
      <detail-list-item term="手机号">{{info.phone}}</detail-list-item>
      <detail-list-item term="联系地址">{{address}}</detail-list-item>
      <detail-list-item term="退货地址">{{return_address}}</detail-list-item>
      <detail-list-item term="供应商性质">{{info.nature}}</detail-list-item>
      <detail-list-item term="经营范围">{{info.business_scope}}</detail-list-item>
      <detail-list-item term="发货时效">{{info.delivery_time}} 小时</detail-list-item>
      <detail-list-item term="结算方式">{{info.settlement_method}}</detail-list-item>
      <detail-list-item term="是否支持开票">{{info.support_invoicing}}</detail-list-item>
      <detail-list-item term="收款账号">{{info.collection_account}}</detail-list-item>
      <detail-list-item term="营业执照"></detail-list-item>
    </detail-list>
    <a-divider style="margin-bottom: 32px"/>
    <detail-list title="综合评分">
      <detail-list-item term="">TODO</detail-list-item>
    </detail-list>
    <detail-list title="产品品质">
      <detail-list-item term="销售额">TODO</detail-list-item>
      <detail-list-item term="上品数量">TODO</detail-list-item>
      <detail-list-item term="订单量">TODO</detail-list-item>
      <detail-list-item term="21天内售后率">TODO</detail-list-item>
      <detail-list-item term="产品品质">TODO</detail-list-item>
    </detail-list>
    <detail-list title="服务能力">
      <detail-list-item term="实际时效（小时）">TODO</detail-list-item>
      <detail-list-item term="承诺时效（小时）">TODO</detail-list-item>
      <detail-list-item term="承诺差（小时）">TODO</detail-list-item>
    </detail-list>
    <detail-list title="信用值">
      <detail-list-item term="承诺时效">TODO</detail-list-item>
      <detail-list-item term="承诺品质">TODO</detail-list-item>
      <detail-list-item term="产品品质">TODO</detail-list-item>
    </detail-list>
  </a-card>
</template>

<script>
  import DetailList from '@/components/tools/DetailList'
  import { getSupplierInfo } from '@/api/supplier'

  const DetailListItem = DetailList.Item

  export default {
    components: {
      DetailList,
      DetailListItem
    },
    computed: {
      address: function () {
        return [
          this.info.province && this.info.province.name,
          this.info.city && this.info.city.name,
          this.info.area && this.info.area.name,
          this.info.address
        ].join('')
      },
      return_address: function () {
        return [
          this.info.return_province && this.info.return_province.name,
          this.info.return_city && this.info.return_city.name,
          this.info.return_area && this.info.return_area.name,
          this.info.return_address
        ].join('')
      }
    },
    data () {
      return {
        info: {}
      }
    },
    mounted () {
      getSupplierInfo(this.$route.params).then(res => {
        this.info = res
      })
    }
  }
</script>

<style lang="less" scoped>
  .title {
    color: rgba(0, 0, 0, .85);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
  }
</style>
